<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model
{
    //
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    protected $guarded = [];
    // 一对一
    public function userExt(){
        return $this->hasOne(UserExt::class,'user_id');
    }
    // 一对多
    public function arts(){
        return $this->hasMany(Article::class,'user_id');
    }
    // 多对多
    public function auths(){
        return $this->belongsToMany(Auth::class,'user_auths','user_id','auth_id');
    }
}
